package com.timoon.component.panel.jqgrid.action;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;

import com.googlecode.wicket.jquery.ui.form.button.AjaxButton;
import com.timoon.component.panel.jqgrid.JqGridPanel;

public class SearchButton extends AjaxButton {
	private static final long serialVersionUID = 1713930103714821841L;

	private String gridKey;
	
	public SearchButton(String id,JqGridPanel mainPanel) {
		super(id);
		// TODO Auto-generated constructor stub
		this.gridKey=mainPanel.getKey();
	}
	@Override
	protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
		// TODO Auto-generated method stub
		super.onSubmit(target, form);
		
		target.appendJavaScript("myjqgrid.reload('#grid-"+gridKey+"')");
	}

}
